home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Technology Seed / ADC Seed CD - July 1999.toast / USB / Mac OS USB DDK v1.2 / Examples / PrinterClassDriver / Chooser.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-15  |  2.5 KB  |  80 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Chooser.h
  3.  
  4.     Contains:    Header file for Chooser PACK code to support USB and serial printers
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.  
  9.  
  10.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  11.  
  12. */
  13. #ifndef __Chooser__
  14. #define __Chooser__
  15. #define    kUSBModelPathString        1000
  16. #define    kUSBPrinterPathString    2000
  17. #define    kPrinterNameString        2100
  18.  
  19. #ifndef __TYPES__
  20. #include <Types.h>
  21. #endif
  22.  
  23. #include <CodeFragments.h>
  24.  
  25. typedef struct
  26. {
  27. // address of name registry routines
  28.     ProcPtr        RegistryEntryIDInitAddr;
  29.     ProcPtr        RegistryCStrEntryLookupAddr;
  30.     ProcPtr        RegistryEntryIterateCreateAddr;
  31.     ProcPtr        RegistryEntryIterateDisposeAddr;
  32.     ProcPtr        RegistryEntryIterateSetAddr;
  33.     ProcPtr        RegistryEntryIterateAddr;    
  34.     ProcPtr        RegistryEntryIDDisposeAddr;    
  35.     ProcPtr        RegistryPropertyGetAddr;
  36.  
  37.     CFragConnectionID sCID;                    // our connection id to the name registry library
  38.  
  39.     Boolean        hasNameRegistry;            // does this cpu have a name registry
  40.     Boolean        checkedForNameRegistry;        // did we check for the name registry already
  41.  
  42.     short        numberOfPrinters;            // total number of printers listed (unused for now)
  43.     short        numberOfUSBPrinters;        // total number of USB printers
  44.     short        numberOfPorts;                // total number of serial ports (0-if we don't support serial)
  45.  
  46.     Boolean        supportsSerial;                // do we support serial
  47.     Boolean        supportsUSB;                // do we support USB
  48. // holds index into our STR# rsrc (name registry model path) for each entry in the printer list
  49.     short*        modelIndex;
  50. } USBGlobals, *USBGlobalsPtr, **USBGlobalsHandle;
  51.  
  52. typedef    struct
  53. {
  54.     unsigned short    branch;        // Branch instruction.
  55.     unsigned short    devID;        // Device ID.
  56.     OSType            resType;    // Resource type (always 'PACK').
  57.     short            resID;        // Resource ID (always -4096).
  58.     short            version;    // Printer driver version.
  59.     unsigned long    flags;        // Flag bits.
  60.     long int        storage;    // our storage
  61.     Str31            driverName;    // Name of printer driver.
  62.     char            code[1];    // PACK code starts here.
  63. } ChooserPACKHeader, *ChooserPACKHeaderPtr, **ChooserPACKHeaderHdl;
  64.                                         
  65. // description of the connection rsrc CTYP
  66. typedef struct
  67. {
  68.     short    selectedType;        // connection type of the selected printer
  69.     short    supportsSerial;        // do we support serial
  70.     short    supportsUSB;        // do we support USB
  71. } ConnectionType, *ConnectionTypePtr, **ConnectionTypeHdl;
  72.  
  73. extern    OSErr    InitGlobalStorage(void);
  74. extern    void    RemoveGlobalStorage(void);
  75. extern    USBGlobalsHandle    GetGlobalStorage(void);
  76. extern    pascal OSErr Chooser(    short message, short caller, StringPtr objName,
  77.                         StringPtr zoneName, long p1, long p2    );
  78.  
  79. #endif
  80.